package com.NeuglsWorkStudio.UI.FormElement.Component
{
	import com.NeuglsWorkStudio.UI.FormElement.Config.TConfig;
	import com.NeuglsWorkStudio.UI.FormElement.Config.TLoaderAnimaterConfig;
	import com.NeuglsWorkStudio.UI.FormElement.Config.TProgressBarConfig;
	
	public class TLoaderAnimater extends TComponent
	{
		
		private var progressBar:TProgressBar;
		
		public function TLoaderAnimater(AConfig:TConfig)
		{
			super(AConfig);
		}
		
		public function LoaderAnimaterConfig():TLoaderAnimaterConfig{
			return _FConfig as TLoaderAnimaterConfig;
		}
		
		protected override function Init():void{
			super.Init();
			var C:TProgressBarConfig=new TProgressBarConfig();
			C.BaseColor=LoaderAnimaterConfig().BaseColor;
			C.Height=LoaderAnimaterConfig().Height;
			C.Max=100;
			C.Min=0;
			C.Name=LoaderAnimaterConfig().Name;
			C.Width=LoaderAnimaterConfig().Width;
;
			C.Position=0;
			C.x=0;
			C.y=0;
			progressBar=new TProgressBar(C);
			this.addChild(progressBar);
		}
		
		public function SetPercent(p:int):void{
			progressBar.Position=p;
		}
		
		public static function NewLoaderAnimater():TLoaderAnimater{
			return new TLoaderAnimater(TLoaderAnimaterConfig.GetDefaultLoaderAnimaterConfig());
		}
	}
}